<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    /*css注释  Ctrl+Shift+/   */
  </style>
</head>
<body>
<input type="button" value="按钮" onclick="f1()">
<!--html注释  Ctrl+Shift+/    -->
<script>
  //js单行注释   Ctrl+/
  /*js多行注释    Ctrl+Shift+/ */

  //1. 无参无返回值方法
  function f1() {
    console.log("f1")
  }
  //调用方法
  f1();
  //2. 有参无返回值
  function f2(name,age) {
    console.log(name+":"+age);
  }
  f2("刘德华",50);
  //3. 无参有返回值
  function f3() {
    return "这是返回值";
  }
  let info = f3();
  console.log(info)
  //4. 有参有返回值
  function f4(x,y) {
    return x*y;
  }
  let result = f4(8,9);
  console.log(result)

  //第二种定义方法的格式
  let f5 = function (name,age) {
    console.log(name+":"+age);
  }
  f5("张学友",40);
  //第三种定义方法的格式
  let f6 = new Function("name","age","console.log(name+':'+age)");
  f6("郭富城",60);






</script>
</body>
</html>